<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('修改质检规则')" />

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="">
                    <div>&nbsp;</div>
                    <input type="hidden" name="id">
                    <div class="layui-form-item">
                        <label class="layui-form-label">规则名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="mc" placeholder="规则名称" lay-verify="required" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <!--<div class="layui-form-item">
                        <label class="layui-form-label">质检方式</label>
                        <div class="layui-input-block">
                            <input type="text" name="show_fs" placeholder="质检方式" lay-verify="required" autocomplete="off" class="layui-input " readonly/>
                        </div>
                    </div>-->
                    <label class="layui-form-label">质检方式</label>
                    <div class="layui-input-inline">
                        <select name="fs" lay-filter="aihao" disabled="disabled">
                            <option value=""></option>
                            <option value="0" selected="">全检</option>
                            <option value="1">百分比抽检</option>
                            <option value="2">固定数量抽检</option>
                        </select>
                    </div>




                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" jq-filter="submit" lay-submit="" lay-filter="editZj">保存</button>
                            <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                        </div>
                    </div>
                    <input type="hidden" th:value="${id}" id="zjid">
                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

    })
    function editSelect2(dom,value){

    }
</script>
<script>
    layui.use(['myform','zzpUtils','form','jquery'],function () {
        var form = layui.form,
            zzpUtils = layui.zzpUtils,
            $ = layui.jquery;
        var ids=$("#zjid").val();
        zzpUtils.action({
            url:"/wmsqualitytesting/getWmsQualityTesting",
            data: JSON.stringify({id:ids}),
            success:function (data) {
                zzpUtils.loadJsonDataToForm(data);
            },error: function (xhr, textStatus) {
                console.log(textStatus);
                console.log(xhr)
            }
        });

        form.on("submit(editZj)",function(data){
            console.log(zzpUtils.getFormJson($("#form1")));
            zzpUtils.confirm("是否确定修改",function(index){
                zzpUtils.action({
                    url:"/wmsqualitytesting/edit",
                    data:JSON.stringify(data.field),
                    success:function (data) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            top.layer.msg(data.title);
                        },500);
                    },error: function (xhr, textStatus) {
                        console.log(textStatus);
                        console.log(xhr)
                    }
                })
            })
            return false;

        });
    });
</script>
</html>